/* ===== 기본 초기화 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  background: #fff;
  -webkit-tap-highlight-color: transparent; /* 모바일에서 누를 때 파란 박스 안 생기게 */
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;

    background: #F5F5F5;

    font-family: serif;

    overflow-x: hidden;
}
/* 새로고침 버튼 */
.reload-button {
    line-height: 1;
    padding-bottom: 5px;
    position: fixed;
    top: 125px;
    left: 4vw;

    width: 50px;
    height: 45px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255,255,255,0.85);
    border: 2px solid #707070;

    font-family: "Noto Sans", sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: #707070;

    text-decoration: none;
    cursor: pointer;

    z-index: 99000;
}

.reload-button:hover {
    opacity: 0.6;
}



/* 뒤로가기 버튼 */
.back-button {
    position: fixed;
     top: 1vw;
    left: 4vw;

    font-family: "Noto Sans", sans-serif;
    font-size: 40px;
    font-weight: 400;

    color: #707070;
    text-decoration: none;

    z-index: 9999;
}


.back-button:hover {
    opacity: 0.6;
}
/* =========================
   BACKGROUND
========================= */

.background-selector {
    position: fixed;

    top: 60px;
    left: 4%;

    z-index: 99000;
}

#backgroundBtn {
    width: 120px;
    height: 45px;

    background: rgba(255,255,255,0.85);

    border: 2px solid #707070;
font-family: "Pixelify Sans", sans-serif;
    font-size: 15px;
    font-weight: 700;

    color: #707070;

    cursor: pointer;
}

/* 선택창 */

.background-panel {

    display: none;

    margin-top: 8px;

    width: 250px;

    padding: 12px;

    background: rgba(255,255,255,0.92);

    border: 2px solid #707070;

    display: none;

    flex-wrap: wrap;

    gap: 8px;
}

.background-panel.open {
    display: flex;
}


/* 배경 이미지 미리보기 */

.background-item {
    width: 68px;
    height: 68px;

    padding: 0;
    border: 1px solid #707070;


    background: white;
    cursor: pointer;

    overflow: hidden;
}

.background-item img {
    width: 100%;
    height: 100%;

    object-fit: cover;

    display: block;
}

/* 컬러 */

.color-item {

    width: 68px;
    height: 68px;

    border: 1px solid #707070;

    cursor: pointer;
}


/* =========================
   DRESS UP AREA
========================= */

.dressup-area {

    position: relative;

    width: min(90vw, 700px);

    height: 850px;

    margin: 0 auto;

    top: 100px;
}


/* 캐릭터 */

.dressup-character {

    position: absolute;

    left: 45%;
    top: 20px;

    transform: translateX(-50%);

    width: 180px;

    cursor: grab;

    z-index: 100;
}

.dressup-character img {
    width: 100%;

    display: block;

    user-select: none;

    pointer-events: none;
}


/* 강아지 */

.dressup-dog {

    position: absolute;

    left: 48%;
    top: 140px;

    width: 100px;

    cursor: grab;

    z-index: 100;
}

.dressup-dog img {
    width: 100%;

    display: block;

    user-select: none;

    pointer-events: none;
}


/* 드래그 */

.draggable {
    touch-action: none;
    user-select: none;
}

/* =========================
   ITEM TABS
========================= */

.item-tabs {
    position: relative;

    z-index: 1000;

    width: min(90vw, 660px);

    margin: -400px auto 0;

    display: flex;

    justify-content: center;
}


.item-tab {
    position: relative;
    z-index: 1001;

    flex: 1;

    min-height: 60px;

    background: white;

    border: 3px solid #707070;

    font-family: "Pixelify Sans", sans-serif;
    font-size: 15px;
    font-weight: 500;

    color: #707070;

    cursor: pointer;

    pointer-events: auto;
}

.item-tab.active {
    background: #A1A1A1;
    font-weight: 900;
    color: #707070;
}


/* =========================
   ITEM LIST
========================= */

.item-list {
    position: relative;

    z-index: 900;

    width: min(90vw, 660px);
    box-sizing: border-box;

    min-height: 500px;

    margin: 0 auto;

    border: 3px solid #707070;

    background: rgba(255,255,255,0.8);

    padding: 25px;
}


/* =========================
   ITEM BUTTON
========================= */
.item-button {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;

    padding: 0;
    margin: 0;

    border: 1px solid #707070;
    background: transparent;

    cursor: grab;
    touch-action: none;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;
}
.item-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}
#itemList {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    
    column-gap: 12px;
    row-gap: 12px;

    justify-content: center;
    align-content: start;
}

.worn-item {
    position: absolute;

    height: auto;

    max-width: none;

    margin: 0;
    padding: 0;

    border: none;

    background: transparent;

    cursor: grab;

    pointer-events: auto;

    touch-action: none;

    user-select: none;
}

.worn-item:active {
    cursor: grabbing;
}
.drag-preview {
    position: fixed;
    z-index: 99999 !important;
    pointer-events: none;
    user-select: none;
    object-fit: contain;
    display: block;
}
/* 드래그 중인 옷은 항상 제일 위 */
.drag-preview {
    position: fixed;
    z-index: 99999 !important;
    pointer-events: none;
    user-select: none;
    object-fit: contain;
    display: block;
}