* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f0f0f0;
  font-family: sans-serif;
  padding: 20px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  justify-content: center;
  position: sticky;
  top: 0; 
  z-index: 1000; 
}

.toolbar button,
.toolbar select,
.toolbar input[type="color"],
.toolbar input[type="number"] {
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fafafa;
  cursor: pointer;
  min-width: 50px;
  flex: 1 1 auto; 
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
}

.canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  width: 100%;
  max-width: 100%;
  overflow: auto;
}

canvas {
  width: 80%;
  height: auto;
  max-width: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
  touch-action: none; 
}

.mobile-menu-btn {
  display: none;
  font-size: 24px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
  cursor: pointer;
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1001;
  margin-left: auto;
}

.toolbar-items {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

@media (max-width: 600px) {
  .mobile-menu-btn {
    display: inline-block; 
  }

  .toolbar-items {
    display: none; 
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 220px;
    padding: 10px;
    background: #fff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.3);
    z-index: 1000;
    overflow-y: auto;
  }

  .toolbar-items.show {
    display: flex; 
  }

  .canvas-wrapper {
    margin-top: 20%;
    padding-right: 0;
  }

  canvas {
    width: 100%;
  }
}