@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c&display=swap');

body,
html {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: auto;
    position: fixed;
    top: 0;
    left: 0;
    touch-action: pan-x pan-y manipulation;
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-weight: 400;
    font-style: normal;
}

a {
    color: #b19ddb;
    text-decoration: none;
}

.contents {
    width: 100%;
    max-width: 600px;
    position: relative;
}

#loading {
    width: 100%;
    height: 100%;
    background-color: #131313;
    position: absolute;
    z-index: 99999;
}

#loading img {
    width: 300px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#leftBtnArea {
    position: absolute;
    width: 20%;
    height: calc(100% - 40vw - 170px);
    margin-top: .3rem;
    margin-left: .3rem;
    z-index: 1;
}

.avabtn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: #FFF;
    border: none;
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avabtn .button-text {
    position: absolute;
    bottom: -4px;
    width: 100%;
    text-align: center;
    font-weight: bold;
    font-size: 0.65rem;
    color: #b19ddb;
    white-space: nowrap;
}

.button-active {
    background-color: #b19ddb;
}

.button-active .button-text {
    color: #FFF;
}

#avatarMode,
#decoMode {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    background-color: #EEE;
}

#avatarCanvasContainer {
    overflow: auto;
    margin: 0 auto;
}

#avatarEditArea,
#decoEditArea {
    position: absolute;
    width: 100%;
    max-height: 330px;
    bottom: 50px;
    display: flex;
    align-content: flex-start;
    flex-wrap: wrap;
    background-color: rgba(255, 255, 255, 0.5);
    z-index: 20;
}

#avatarCanvas {
    width: 100%;
    height: fit-content;
    display: flex;
    justify-content: center;
    transition: transform 0.2s ease-in-out;
}

#thumbnails,
#decoThumbnails {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    width: 100%;
    height: 40vw;
    max-width: 600px;
    max-height: 240px;
    overflow-y: scroll;
    padding-bottom: 20px;
}

.thumbnail {
    display: inline-block;
    background-size: cover;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    box-sizing: border-box;
    width: 20vw;
    height: 20vw;
    max-width: 120px;
    max-height: 120px;
    border-radius: .3rem;
    border: 2px solid #D3D3D3;
    background-color: rgba(255, 255, 255, 0.6);
}

.thumbnail.selected {
    border: 2px solid #b19ddb;
}

.thumbnail.currently-selected {
    border: 2px solid #ff6f8c;
}

.thumbnail.selected::before {
    content: attr(data-order);
    position: absolute;
    top: 0;
    left: 0;
    color: #fff;
    background-color: #b19ddb;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.thumbnail img {
    width: 100%;
    height: 100%;
}

canvas {
    border: 1px solid black;
    display: block;
    margin: auto;
}

#mainCategoryButtons {
    width: 100%;
    height: 30px;
    display: flex;
    justify-content: flex-start;
    background-color: rgba(255, 255, 255, .9);
    overflow-x: scroll;
}

.main-category-button {
    width: 20%;
    padding: 5px 0;
    background-color: rgba(0, 0, 0, .1);
    color: #999;
    text-align: center;
    cursor: pointer;
    transition: .2s ease-in-out;
    font-size: 0.8rem;
    font-weight: bold;
    border-bottom: 3px solid transparent;
    box-sizing: border-box;
    white-space: nowrap;
}

.main-category-button.active {
    background-color: rgba(255, 255, 255, .9);
    color: #b19ddb;
    border-bottom: 3px solid #b19ddb;
}

#categoryButtons,
#decoCategoryButtons {
    width: 100%;
    height: 40px;
    background-color: rgba(255, 255, 255, .6);
    border-top: 1px solid #EEE;
    border-bottom: 1px solid #EEE;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-button {
    /* width: 20px; */
    flex: 0 0 auto;
    cursor: pointer;
    border: none;
    color: #666;
    border-radius: .5rem;
    padding: .5rem 1rem;
    font-size: 1rem;
    margin: 0.3rem;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
}

.category-button.selected-category {
    background-color: #ff6f8c;
    color: white;
}

.tooltip {
    position: absolute;
    font-size: 0.8rem;
    padding: 0.5rem;
    background-color: #131313;
    color: #FFF;
    border-radius: 0.3rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    /* 矢印の位置調整 */
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background-color: #131313;
    z-index: -1;
}

#colorPalette {
    width: 100%;
    height: 30px;
    /* background-color: rgba(0, 0, 0, 0.2); */
    display: flex;
    align-items: center;
    padding: 0.2rem;
    border-bottom: 1px solid #EEE;
}

.color-button {
    border: 1px solid #FFF;
    width: 25px;
    height: 25px;
    border-radius: .3rem;
    margin-left: 0.3rem;
    box-sizing: border-box;
}

.color-button.selected {
    box-shadow: 0 0 0 2px #fff, inset 0 0 1px 2px rgba(0, 0, 0, .3);
}

.color-button:last-child {
    margin-right: 0.3rem;
}

#adp {
    width: 100%;
    height: 50px;
    background-color: #666;
    position: fixed;
    bottom: 0;
    z-index: 99999;
}

#rightBtnArea,
#decorightBtnArea {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    justify-content: end;
    flex-wrap: wrap;
    width: 20%;
    z-index: 1;
    height: calc(100% - 40vw - 140px);
    min-height: calc(100% - 380px);
    margin: 0.3rem;
}

#decorightBtnArea {
    align-content: flex-end;
    padding-bottom: 10px;
    box-sizing: border-box;
}

#leftBtnArea {
    position: absolute;
    width: 20%;
    height: calc(100% - 40vw - 170px);
    margin-top: .3rem;
    margin-left: .3rem;
    z-index: 1;
}

#downloadBtn,
#decoDownloadBtn {
    padding: 1rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#downloadBtn:hover,
#decoDownloadBtn:hover {
    background-color: #45a049;
}

#avatarSlotModal {
    display: none;
    position: fixed;
    align-items: center;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
}

#avatarSlotsContainer {
    position: relative;
    width: 80%;
    height: fit-content;
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-sizing: border-box;
}

#avatarSlotsContainer h2 {
    margin: 0;
    font-size: 1.2rem;
}

#avatarSlotsContainer h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: normal;
    margin: 1rem 0;
}

#closeSlotModal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    font-size: 2rem;
    background-color: unset;
}

#showSaveSlots {
    background-image: url('../img/icon/saveslot.svg');
    margin-bottom: 1rem;
}


.editBtns {
    position: absolute;
    bottom: 10px;
}

#editColorBtn {
    background-image: url('../img/icon/color.svg');
    margin-bottom: 1rem;
}

#editPositionBtn {
    background-image: url('../img/icon/adjust.svg');
}

#changeOrderButton {
    background-image: url('../img/icon/adjust.svg');
}

#finishBtn {
    background-image: url('../img/icon/finish.svg');
}

#flipObjectBtn {
    background-image: url('../img/icon/reverse.svg');
    margin-bottom: 1rem;
}

#deleteObjectBtn {
    background-image: url('../img/icon/reverse.svg');
}

#editFinishBtn {
    background-image: url('../img/icon/reverse.svg');
    margin-bottom: 1rem;
}

#toggleModeBtn {
    background-image: url('../img/icon/decomode.svg');
    margin-bottom: 1rem;
}

#showLoadSlots {
    border: none;
    width: 100%;
    margin-top: 1rem;
    padding: .5rem;
}

#avatarslots {
    width: 100%;
    height: 80%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

#avatarslots .avatarslot {
    width: 100px;
    max-width: 32%;
    height: 150px;
    border-radius: 0.5rem;
    border: 1px solid #666;
    box-sizing: border-box;
    position: relative;
    display: flex;
    align-items: center;
}

#decoThumbnails .avatarslot {
    width: calc(40vw / 3 * 2);
    height: 40vw;
    max-width: 160px;
    max-height: 240px;
    box-sizing: border-box;
    border-radius: 0.5rem;
    border: 1px solid #666;
    position: relative;
}

#avatarslots .avatarslot .slot-number,
#decoThumbnails .avatarslot .slot-number {
    position: absolute;
    top: 0;
    left: 0;
}

#avatarslots .avatarslot img,
#decoThumbnails .avatarslot img {
    width: 100%;
}

.saveForDecoBtn,
.loadSavedAvatarBtn {
    position: absolute;
    bottom: 0.1rem;
    width: 2rem;
    height: 2rem;
    background-size: contain;
    background-color: unset;
    border: none;
    cursor: pointer;
}

.saveForDecoBtn {
    left: 0.1rem;
    background-image: url('../img/icon/save.svg');
}

.loadSavedAvatarBtn {
    right: 0.1rem;
    background-image: url('../img/icon/load.svg');
}

/* #decoCategoryButtons {
    width: 100%;
    height: 50px;
    background-color: #D3D3D3;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
} */

.deco-category-button {
    cursor: pointer;
    border: none;
    color: #666;
    background-color: #333;
    border-radius: .5rem;
    padding: .5rem 1rem;
    font-size: 1rem;
    margin: 0.3rem;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.deco-category-button img {
    width: 100%;
    height: 100%;
}

.deco-category-button.selected-category {
    background-color: #ff6f8c;
    color: white;
}

@keyframes slideOut {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.avatarEditArea-hidden {
    animation: slideOut 0.5s forwards;
}

.avatarEditArea-visible {
    animation: slideIn 0.5s forwards;
}

#editHiddenBtn {
    width: 40px;
    height: 40px;
    padding: .6rem;
    box-sizing: border-box;
    background-color: #FFF;
    color: #FFF;
    position: absolute;
    z-index: 20;
    border: none;
    border-radius: 0.3rem;
    left: .3rem;
}

#editHiddenBtn {
    top: -45px;
}

.thumbnail .delete-icon {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
    background-color: #ff6f8c;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.thumbnail .delete-icon img {
    width: 80%;
    height: 80%;
}

#notification {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1000;
}

#toggleShowParts {
    background-color: rgba(0, 0, 0, .5);
    width: 80%;
    height: 35px;
    display: flex;
    justify-content: space-evenly;
    border-radius: 3rem;
    position: absolute;
    left: 50%;
    bottom: 60px;
    transform: translateX(-50%);
    z-index: 3;
    transition: transform 0.3s ease-in-out;
}

#toggleShowParts button {
    border: none;
    background-color: unset;
    color: #FFF;
    font-family: "M PLUS Rounded 1c", sans-serif;
    font-weight: bold;
    transition: transform 0.3s ease;
    text-align: center;
    padding: 0.3rem 1rem;
    margin: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggleShowParts button.active {
    background-color: #FFF;
    color: #b19ddb;
    border-radius: 3rem;
}

#adjustColor {
    width: 100%;
    height: calc(40vw + 20px);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0 auto;
    position: absolute;
    bottom: 50px;
    z-index: 100;
    background-color: #CCC;
}

#adjustOpacitySlider,
.colorAdjustments {
    width: 45%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #131313;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    outline: none;
    height: 14px;
    width: 100%;
    background: #FFF;
    border-radius: 10px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    background: #b19ddb;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.15);
}

input[type="range"]::-moz-range-thumb {
    background: #b19ddb;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.15);
    border: none;
}

input[type="range"]::-moz-focus-outer {
    border: 0;
}

input[type="range"]:active::-webkit-slider-thumb {
    box-shadow: 0px 5px 10px -2px rgba(0, 0, 0, 0.3);
}

.disabled,
.disabled input[type="range"] {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.disabled input[type="range"]::-webkit-slider-thumb,
.disabled input[type="range"]::-moz-range-thumb {
    background: #ccc;
}

#scaleButtons {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

#scaleButtons button {
    border: none;
    border-radius: .3rem;
    padding: .3rem;
    background-color: #b19ddb;
    color: #FFF;
    text-align: center;
    margin: .3rem;
    flex-basis: calc(50% - .6rem); /* ボタンを2個ずつ並べる */
    width: calc(50% - .6rem); /* ボタンの横幅を同じにする */
}

#adjustColorReset,
#adjustPartsReset,
#flipBtn {
    border: none;
    border-radius: .3rem;
    width: 150px;
    text-align: center;
    margin: 0 auto;
    margin-top: 1rem;
    margin-bottom: .5rem;
    padding: .3rem;
    background-color: #b19ddb;
    color: #FFF;
}

#adjustParts {
    width: 100%;
    height: calc(40vw + 20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin: 0 auto;
    position: absolute;
    bottom: 50px;
    z-index: 100;
    background-color: transparent;
    padding: .3rem;
    box-sizing: border-box;
}

.side-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 20px;
}

#positionData {
    width: 100%;
}

#rotateBtns {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: fit-content;
    background-color: #b19ddb;
    border-radius: 0.3rem;
}

#rotateBtns button {
    width: 50px;
    height: 50px;
    border: none;
    background-color: transparent;
    cursor: pointer;
}

#rotateLBtn,
#rotateRBtn {
    background-image: url('../img/icon/rotation.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 80%;
}

#rotateRBtn {
    background-image: url('../img/icon/rotation.svg');
    transform: scaleX(-1);
}

#divider {
    width: 1px;
    height: 30px;
    background-color: #CCC;
}

.adjust-side-button {
    width: 25%;
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-end;
}

.adjust-side-button button {
    height: fit-content;
}

#directionBtn {
    width: 40%;
    max-width: 200px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    display: inline-block;
    opacity: 0.9;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#directionBtn:active {
    background-color: transparent;
}

#directionBtn:focus {
    outline: none;
}

#directionBtn svg {
    pointer-events: none;
}

#directionBtn svg .arrow {
    pointer-events: all;
    fill: #EEE;
    stroke: #131313;
    stroke-width: 2;
}

#directionBtn svg .arrow:active {
    fill: #ff6f8c;
}

#RightPCAx,
#leftPCAx {
    display: none;
}

#sharePageBtns {
    position: absolute;
    width: 100%;
    top: 700px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

#sharePageBtns button {
    width: 80%;
    max-width: 480px;
    border: none;
    padding: .8rem;
    border-radius: 3rem;
    margin-bottom: .5rem;
    font-weight: bold;
    font-family: "M PLUS Rounded 1c", sans-serif;
    background-color: #FFF;
}

#sharePageMes {
    position: absolute;
    top: 620px;
    display: flex;
    justify-content: center;
    width: 100%;
    text-align: center;
}

@media (min-width: 480px) {
    body {
        display: flex;
        justify-content: center;
        flex-wrap: nowrap;
    }

    #adp {
        display: none;
    }

    .contents {
        width: 600px;
        min-height: 600px;
    }

    #avatarMode,
    #decoMode {
        width: 600px;
        min-height: 600px;
    }

    #avatarEditArea {
        height: calc(40vw + 140px);
        max-height: 380px;
        bottom: 0;
    }

    #thumbnails,
    #decoThumbnails,
    #adjustColor,
    #adjustParts {
        height: calc(40vw + 50px);
        max-height: 290px;
        bottom: 0;
        padding-bottom: 20px;
    }

    #adjustOpacitySlider,
    .colorAdjustments {
        width: 80%;
    }

    .thumbnail {
        width: 114px;
        height: 114px;
    }

    #mainCategoryButtons {
        scrollbar-width: none;
    }

    #categoryButtons {
        scrollbar-width: none;
    }

    #categoryButtons::-webkit-scrollbar {
        width: 8px;
    }

    #categoryButtons::-webkit-scrollbar-track {
        background: #f0f0f0;
    }

    #categoryButtons::-webkit-scrollbar-thumb {
        background-color: #ccc;
        border-radius: 10px;
        border: 2px solid #f0f0f0;
    }

    #leftPCAx {
        display: block;
        width: 300px;
        height: 100%;
        background-color: #666;
        flex-shrink: 0;
    }

    .thumbnail.thumbnail.selected::before,
    .thumbnail .delete-icon {
        width: 25px;
        height: 25px;

    }
}

@media (min-width: 900px) {
    #RightPCAx {
        display: block;
        width: 300px;
        height: 100%;
        background-color: #666;
        flex-shrink: 0;
    }
}