* {
  box-sizing: border-box;
}

canvas { display:block; margin:0 auto; background:#eee; }

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#welcomeOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#welcomeImageWrapper {
  position: relative;
}

#welcomeImage {
  max-width: 60vw;
  max-height: 60vh;
}

#welcomeClose {
  position: absolute;
  bottom: 4vh;
  right: 4vw;
  height: 7vh;
  width: auto;
  cursor: pointer;
}

#fridgeCanvas {
  user-select: none;
  cursor: default;
  position: fixed;
  inset: 0;          /* top:0 right:0 bottom:0 left:0 */
  display: block;
}

/* Modal for drawing */
#drawingModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 1em;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#drawingCanvas {
  border: 1px solid white;
  background-color: white;
  user-select: none;
  touch-action: none;
}
.modal-toolbar {
  display: flex;
  justify-content: center;
  margin-top: 0.8em;
}

.modal-top-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  padding: 5px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

#brushButtonsContainer {
  display: flex;
  gap: 10px;
  width: 100%;
  padding-left: 20px;
  padding-right: 10px;
}

.tool-btn {
  flex: 1;
  aspect-ratio: 1 / 1;
  background: #eee;
  border: 2px solid transparent;
  border-radius: 25%;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tool-btn img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  pointer-events: none; /* important so clicks hit button */
}

/* Active tool highlight */
.tool-btn.active {
  background: #ffffff;
  border-color: #007aff;
}

/* Optional hover feedback */
.tool-btn:hover {
  background: #f5f5f5;
}

#brushSizeContainer {
    width: 50%;
  margin-left: 60px;
  margin-right: 50px;
  height: 106px;  /* track thickness */
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column; /* vertical layout */
  align-items: center;
}

#brushSizeSlider {
  position: relative;
  width: 100%;
  height: 106px;            /* 🔑 REQUIRED */
  background: #ccc;
  clip-path: polygon(0% 47%, 100% 0%, 100% 100%, 0% 53%);
  cursor: pointer;
}

#brushSizeSliderBall {
  position: absolute;
  width: 105px;
  height: 105px;            /* 🔑 REQUIRED */
  top: 1%;
  left: 87%;
  background: #ccc;
  border-radius: 50%;
}

#brushSizeDot {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  background: #000;
  border-radius: 50%;
  width: 16px;   /* initial dot size */
  height: 16px;
}

#colorPalette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.color-swatch {
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
}

.color-swatch.active {
  outline: 2px solid white;
  outline-offset: 2px;
}

.done-btn {
  cursor: pointer;
  vertical-align: middle; /* align with color picker */
  height: 48px;
  margin-left: 16px;       /* spacing between color picker and button */
}

#helpBtn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #3da4ff; /* blue */
  color: white;
  border: 4px solid white;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 1000;
}

#helpBtn:hover {
  background-color: white;
  color: #3da4ff;
  border-color: #3da4ff;
}

#addDrawingBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: #dc7d3d;
  color: white;
  border-color: white;
  border-width: 6px;
  font-size: 64px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 1000;
  border-style: solid;
}

#addDrawingBtn:hover {
  background-color: white;
  color: #dc7d3d;
  border-color: #dc7d3d;
}