body {
  background: #ffffff;
  background-image:
    linear-gradient(to right, #d0e1f9 1px, transparent 1px),
    linear-gradient(to bottom, #d0e1f9 1px, transparent 1px);
  background-size: 20px 20px;
  font-family: 'Pixel', sans-serif;
  font-size: 10px;
  color: #5D536B;
  margin: 0;
  padding: 15px;
  box-sizing: border-box;
  user-select: none;
}

a:link, a:visited, a:active {
  color: #7e82e6;
  text-decoration: underline;
}

a:hover {
  color: #999;
}

b { color: #A3CBFF; font-weight: normal; }
i { color: #C096FF; font-style: normal; }
s { color: #FFB8DD; text-decoration: none; }

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #FFD1E6, #FFE3E3, #FFF1C5, #FFFCE6, #E8FAD6, #D4EDDA, #D1F2FF, #CCE5FF, #E2D9F3, #F2E6FF);
  border-radius: 5px;
}

.box-window {
  background: #FFF;
  border: 1px dotted #C6D9EC;
  padding: 2px;
  margin-bottom: 2px;
}

.iframe-body {
  background: #ffffff !important;
  background-image: none !important;
  user-select: auto !important;
  padding: 10px;
}

.drawbox-wrapper {
  padding: 10px;
  background: #FFF;
}

.drawbox-tools {
  background: #F2E6FF;
  border: 1px solid #FFD1E6;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
  box-shadow: inset 1px 1px 0 #FFF;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.drawbox-tools input[type="range"],
.drawbox-tools input[type="color"] {
  border: 1px dotted #AFA3C0;
  background: #F2E6FF;
  height: 28px;
  cursor: pointer;
}

.drawbox-tools button {
  background: #F2E6FF;
  border: 1px solid #FFF;
  box-shadow: 1px 1px 1px #AFA3C0;
  color: #5D536B;
  font-weight: bold;
  font-size: 10px;
  padding: 4px 20px;
  min-width: 50px;
}

.drawbox-tools button:hover {
  background: #FFD1E6;
}

.drawbox-canvas-frame {
  border: 2px dotted #F2E6FF;
  padding: 10px;
  background: #FFF;
  border-radius: 4px;
  width: fit-content;
  margin: 0 auto 20px auto;
}

#drawboxcanvas {
  pointer-events: auto !important;
}

.drawbox-gallery {
  background: #F2E6FF;
  border: 1px solid #FFD1E6;
  padding: 10px;
  border-radius: 4px;
  box-shadow: inset 1px 1px 0 #FFF;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;  
}

.image-container {
  flex: 0 0 auto;
  width: 100px;
  height: 100px;
  background: #FFF;
  border: 1px dotted #FFD1E6;
  padding: 4px;
  border-radius: 4px;
  text-align: center;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;   
  border-radius: 3px;
}

.image-container p {
  margin: 2px 0 0;
  font-size: 8px;
  color: #5D536B;
  line-height: 1;
}

.drawbox-tools input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 6px;
  background: #F2E6FF;
  border: 1px dotted #AFA3C0;
  border-radius: 4px;
}

.drawbox-tools input[type="range"]::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  background: #FFEBF1;
  border: 1px solid #FFD1E6;
  border-radius: 4px;
  box-shadow: inset 1px 1px 0 #FFF;
}

.drawbox-tools input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #FFEBF1;
  border: 1px solid #FFD1E6;
  border-radius: 4px;
  box-shadow: inset 1px 1px 0 #FFF;
}

.drawbox-tools input[type="range"]::-moz-range-track {
  background: #F2E6FF;
  border: 1px dotted #AFA3C0;
  height: 6px;
  border-radius: 4px;
}

.color-picker {
  position: relative;
}

.color-picker-popup {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  padding: 8px;
  background: #fff;
  border: 1px solid #FFD1E6;
  box-shadow: 2px 2px 4px #AFA3C0;
}

.color-picker-popup[hidden] {
  display: none;
}

#colorArea {
  display: block;
  width: 180px;
  height: 120px;
  border: 1px dotted #AFA3C0;
  cursor: crosshair;
  touch-action: none;
}

#huePicker {
  display: block;
  width: 180px;
  margin-top: 6px;
}

.drawbox-canvas-frame {
  width: min(400px, 100%);
  box-sizing: border-box;
}

#drawboxcanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}

@media (max-width: 576px) {
  .drawbox-wrapper {
    padding: 5px;
  }

  .drawbox-canvas-frame {
    padding: 5px;
  }

  .drawbox-tools {
    gap: 6px;
  }

  #colorArea,
  #huePicker {
    width: 100%;
    max-width: 180px;
  }
  .drawbox-gallery {
    grid-template-columns: repeat(1, 1fr); 
  }
}
