/* --- Reset & Layout --- */
#hideShow img {
  width: 36px;
  height: 36px;
}
* {
  box-sizing: border-box;
}
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: monospace;
}
.container {
  position: relative;
  width: 100%;
  height: 100%;
}
.drawing-board {
  width: 100%;
  height: 100%;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: url("./Cat.webp") no-repeat left top;
  background-size: 100% 100%;
}
@media screen and (max-width: 1024px) {
  canvas {
    background: url("./Cat.png") no-repeat left top;
    background-size: 100% 100%;
  }
}
@media screen and (max-width: 650px) {
  canvas {
    background: url("./catphone.png") no-repeat left top;
    background-size: 100% 100%;
  }
}

/* make the overlay cover the whole screen */
#previewModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;   /* full viewport */
  height: 100vh;
  background: rgba(0,0,0,0.5);  /* semi-transparent backdrop */
  display: none;                /* hidden by default */
  align-items: center;          /* flex centering */
  justify-content: center;
  z-index: 9999;
}

/* the “dialog” inside it */
#previewModal .modal-content {
  width: 60vw;        /* roughly 60% of viewport width */
  max-width: 90%;     /* never exceed 90% on very small screens */
  max-height: 80vh;   /* prevent it growing too tall */
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ensure the image scales down to fit */
#previewModal .modal-content img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* button‐row stays at bottom */
#previewModal .modal-footer {
  padding: 0.5rem;
  text-align: right;
}

/* on extra-small screens, make it almost full-width */
@media (max-width: 600px) {
  #previewModal .modal-content {
    width: 90vw;
    max-height: 70vh;
  }
}

/* --- Toolbar Overlay (all screens) --- */
#toolbar {
  position: absolute;
  top: 0;
  left: 0;
  width: 180px;
  height: 100%;
  padding: 20px 10px;
  background: rgba(51, 51, 51, 0.75);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 200;
}
#toolbar.open {
  transform: translateX(0);
}

/* --- Toggle Button --- */
#hideShow {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 300;
  cursor: pointer;
}
#hideShow svg {
  fill: #333;
  stroke: #fff;
  stroke-width: 2;
}

/* --- Controls Styling --- */
label {
  font-size: 12px;
  text-transform: uppercase;
}
#stroke, #lineWidth {
  width: 100%;
}
.text-btn {
  width: 100%;
  background: rgba(34, 34, 34, 0.85);
  border: none;
  color: #fff;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
}

.icon-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.icon-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}
.icon-btn img {
  width: 56px;
  height: 56px;
}

/* --- Modal Styling --- */
#previewModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 400;
}
#previewModal .modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 4px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}
#closeModal {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 24px;
  cursor: pointer;
}