* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: monospace;
}
html, body {
  width: 100%;
  height: 100%;
}
#app {
  display: flex;
  flex-direction: row;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
#canvas-container {
  flex: 1;
  background: black;
}
#ui {
  width: 220px;
  min-width: 150px;
  background: #f4efe8;
  border-left: 4px solid #d8cbb6;
  display: flex;
  flex-direction: column;
  padding: 10px;
}

@media (max-width: 600px) {
  .ui-panel {
    width: 120px; /* smaller panel */
    font-size: 0.8em;
  }
  #canvas {
    transform: scale(0.8); /* shrink canvas */
    transform-origin: top left;
  }
}

/* CATEGORY BUTTONS */
#categories button {
  margin-bottom: 6px;
  padding: 8px;
  border: none;
  background: #e8dcc8;
  cursor: pointer;
  font-weight: bold;
}

#categories button.active {
  background: #cbb89d;
}

/* MATERIAL GRID */
#materials {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  justify-items: center;
}

.material {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.material-box {
  width: 40px;
  height: 40px;
  border: 2px solid #999;
  margin-bottom: 4px;
}

.material.selected .material-box {
  border: 3px solid black;
}

.material-label {
  font-size: 10px;
  text-align: center;
}

.eraser-box {
  background: repeating-linear-gradient(
    45deg,#ccc,#ccc 6px,#eee 6px,#eee 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

#ui-footer {
  padding: 10px;
  border-top: 1px solid #333;
}

#clearBtn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  background: #a33;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#clearBtn:hover {
  background: #c44;
}
