* {
 box-sizing: border-box;
 user-select: none;
}
#toolbar label{
 font-size: 14px;
 background: #eee;
 border: 1px solid #ccc;
 border-radius: 4px;
 padding: 4px 8px;
}
body, html {
 margin: 0;
 font-family: Arial, sans-serif;
 display: flex;
 height: 100vh;
 overflow: hidden;
}
#toolbar {
 width: 100%;
 background: #f0f0f0;
 padding: 10px;
 box-sizing: border-box;
 display: flex;
 flex-direction: column;
 gap: 8px;
 border-right: 1px solid #ccc;
 overflow-y: auto; /* <--- add this */
 max-height: 100vh; /* <--- ensures scroll only when needed */
}
#toolbar::-webkit-scrollbar {
 width: 6px;
}
#toolbar::-webkit-scrollbar-thumb {
 background-color: #bbb;
 border-radius: 3px;
}
#toolbar button,
#toolbar select,
 {
 font-size: 14px;
 cursor: pointer;
 background: #eee;
 border: 1px solid #ccc;
 border-radius: 4px;
 padding: 4px 8px;
 transition: background-color 0.2s ease;
}
#toolbar button:hover,
#toolbar select:hover,
 {
 background-color: #ddd;
}
#toolbar label {
 display: flex;
 align-items: center;
 gap: 4px;
 cursor: pointer;
}
 #canvas {
 margin-left: 80px; /* equal to the width of #sideTabs */
 flex-grow: 1;
 background: white;
 display: block;
 }
#toolbar input[type="number"] {
 font-size: 14px;
 background: #eee;
 border: 1px solid #ccc;
 border-radius: 4px;
 padding: 4px 8px;
 transition: background-color 0.2s ease;
 width: 80px;
 box-sizing: border-box;
}
#toolbar input[type="number"]:hover {
 background-color: #ddd;
}
#modearea{
 width: 90%;
 background: #ffffff;
 padding: 5%;
 box-sizing: border-box;
 display: flex;
 flex-direction: column;
 gap: 8px;
 border-right: 1px solid #ccc;
}
label2{
 font-size: 14px;
 background: #ffffff ;
 border: 1px solid #ccc;
 border-radius: 4px;
 padding: 4px 8px;
}
#modearea button,
#modearea select,
 {
 font-size: 14px;
 cursor: pointer;
 background: #eee;
 border: 1px solid #ccc;
 border-radius: 4px;
 padding: 4px 8px;
 transition: background-color 0.2s ease;
}
#modearea button:hover,
#modearea select:hover,
 {
 background-color: #ddd;
}
 #layersList {
 width: 100%;
 list-style: none;
 padding: 0;
 margin: 0;
 max-height: 90vh;
 overflow-y: auto;
 border: 1px solid #ccc;
 background: white;
 }
 #layersList li {
 padding: 6px 8px;
 border-bottom: 1px solid #ddd;
 user-select: none;
 }
 #layersList li:hover {
 background: #e0e0e0;
 }
 #layersList li.active {
 font-weight: bold;
 background: #d0d0d0;
 }
#sideTabs {
 position: fixed;
 top: 0;
 left: 0;
 height: 100%;
 display: flex;
 flex-direction: column;
 z-index: 9999;
}
#sideTabs .tab {
 width: 80px;
 height: 80px;
 background: #ddd;
 display: flex;
 align-items: center;
 justify-content: center;
 border-bottom: 1px solid #aaa;
 cursor: pointer;
}
#sideTabs .tab img {
 width: 48px;
 height: 48px;
}
.tab-content {
 position: fixed;
 top: 0;
 left: -200px;
 width: 200px;
 height: 100%;
 background: #f9f9f9;
 border-right: 1px solid #aaa;
 transition: left 0.3s ease;
 overflow-y: auto;
 z-index: 9998;
 display: flex;
 flex-direction: column;
 align-items: center; /* center horizontally */
 justify-content: flex-start; /* align to top vertically */
 gap: 10px;
 padding: 20px 10px 10px 10px;
}
.tab-content button {
 font-size: 16px;
 padding: 8px 12px;
 border: 1px solid #aaa;
 border-radius: 6px;
 background-color: #eaeaea;
 cursor: pointer;
 transition: background-color 0.2s ease;
}
.tab-content button:hover {
 background-color: #ddd;
}
.tab-content.active {
 left: 80px;
}
#layerOverlay {
 position: fixed;
 top: 10px;
 left: 50%;
 transform: translateX(-50%);
 background: rgba(255, 255, 255, 0.8);
 padding: 6px 12px;
 border-radius: 6px;
 font-weight: bold;
 font-size: 16px;
 z-index: 9999;
 pointer-events: none; /* so it doesn't block mouse interaction */
}

#tab1 .button-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 10px;
}


#tab1 .button-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 10px 10px 0 10px;
}

#tab1 .button-grid button {
  margin-bottom: 0;
}

#layers-list {
  margin-top: 0;
}
