/* 레고 차고 플레이트 및 드래그 앤 드롭 아이템 스타일 */

.garage-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 900px;
  width: 100%;
  margin: auto;
  padding: 10px 0;
}

/* 레고 조립판 (Baseplate) */
.garage-board-wrapper {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: #15803d; /* 클래식 레고 그린 */
  border-radius: 24px;
  border: 12px solid #166534; /* 짙은 녹색 테두리 */
  box-shadow: 0 16px 24px rgba(0,0,0,0.15), inset 0 4px 10px rgba(0,0,0,0.3);
  padding: 4px;
  overflow: hidden;
}

/* 조립판 스터드 배경 (CSS 패턴으로 리얼한 레고판 구현) */
#garage-baseplate {
  position: relative;
  width: 100%;
  height: 380px;
  background-color: #16a34a; /* 기본 판 */
  /* 레고 원형 돌기(Stud) 질감 구현 */
  background-image: radial-gradient(#15803d 30%, transparent 35%);
  background-size: 20px 20px; /* GRID_SIZE 매칭 */
  background-position: 0 0;
  border-radius: 12px;
  touch-action: none; /* 모바일 브라우저의 기본 스크롤/바운스 전면 차단 */
}

/* 조립판 위에 배치된 레고/자동차 아이템 실물 */
.placed-item {
  position: absolute;
  cursor: grab;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}

.placed-item:active {
  cursor: grabbing;
}

/* 레고 브릭 내부의 동그라미 돌기 */
.lego-stud {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset 1.5px 1.5px 0px rgba(255,255,255,0.3), 1px 1px 1.5px rgba(0,0,0,0.2);
}

/* 삭제 버튼 (우측 상단 꼬마 버튼) */
.placed-item-delete {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lego-red);
  color: white;
  border: 2px solid white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  line-height: 1;
  font-weight: bold;
  z-index: 5;
}

/* 회전 버튼 (좌측 상단 꼬마 버튼) */
.placed-item-rotate {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lego-blue);
  color: white;
  border: 2px solid white;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  line-height: 1;
  font-weight: bold;
  z-index: 5;
}


/* 보관함 (인벤토리 도크) */
.inventory-dock {
  background: white;
  width: 100%;
  max-width: 640px;
  border-radius: 24px;
  padding: 15px 20px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  border: 3px solid #cbd5e1;
}

.inventory-title {
  font-size: 18px;
  color: var(--text-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 가로 스크롤 가능한 보상 리스트 */
#unlocked-inventory {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 4px;
  scrollbar-width: thin;
}

#unlocked-inventory::-webkit-scrollbar {
  height: 6px;
}

#unlocked-inventory::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

.inventory-card {
  flex: 0 0 76px;
  background: var(--bg-pastel-yellow);
  border: 3px solid var(--lego-yellow);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  cursor: pointer;
  min-height: 82px;
}

.inventory-icon {
  font-size: 32px;
  margin-bottom: 2px;
}

.inventory-name {
  font-size: 10px;
  color: var(--text-dark);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* 차고 제어 버튼들 */
.garage-controls {
  display: flex;
  gap: 15px;
  width: 100%;
  max-width: 640px;
  justify-content: space-between;
}

.btn-garage-action {
  background: white;
  color: var(--text-dark);
  border: 3px solid var(--text-light);
  font-family: var(--font-kids);
  font-size: 18px;
  padding: 10px 20px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--text-light);
  transition: transform 0.1s;
}

.btn-garage-action:active {
  transform: translateY(4px);
  box-shadow: none;
}

.btn-garage-action.clear {
  background: var(--bg-pastel-red);
  border-color: var(--lego-red);
  color: var(--lego-red-dark);
  box-shadow: 0 4px 0 var(--lego-red-dark);
}
.btn-garage-action.clear:active {
  transform: translateY(4px);
  box-shadow: none;
}

@media (max-width: 640px) {
  .garage-container {
    gap: 14px;
    margin: 0 auto;
  }

  .garage-board-wrapper {
    border-width: 8px;
    border-radius: 18px;
  }

  #garage-baseplate {
    height: min(360px, 58vh);
    min-height: 260px;
  }

  .inventory-dock {
    padding: 12px;
    border-radius: 18px;
  }

  .inventory-title {
    font-size: 16px;
    line-height: 1.25;
  }

  .inventory-card {
    flex-basis: 84px;
  }

  .garage-controls {
    flex-direction: column;
    gap: 10px;
  }

  .btn-garage-action {
    width: 100%;
    font-size: 17px;
  }
}
