body {
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  font-family: sans-serif;
}

h1 {
  text-align: center;
  margin: 10px 0;
}

/* ==== モード切り替え ==== */
#tool-buttons {
  text-align: center;
  margin: 10px 0;
}
#tool-buttons button {
  margin: 3px;
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid #888;
  background: #fff;
}
#tool-buttons button.active {
  background: #007bff;
  color: white;
  border-color: #0056b3;
}

/* ==== レイヤーパネル ==== */
#layer-panel {
  display: flex !important;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}

.layer-item {
  width: 70px;
  text-align: center;
  cursor: pointer;
  padding: 4px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 6px;
}

.layer-item span {
  display: block;
  text-align: center;
  font-size: 12px;
  margin-top: 2px;
}

.layer-item.active-layer {
  border-color: #28a745;
}

.thumb {
  width: 60px;
  height: 60px;
  background: #ddd;
  border: 1px solid #aaa;
  margin: 0 auto 2px;
}

/* ==== レイヤーメニュー ==== */
#layer-menu {
  position: absolute;
  background: #fff;
  border: 1px solid #888;
  border-radius: 6px;
  padding: 5px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 9999;
}
#layer-menu.hidden {
  display: none;
}
#layer-menu button {
  display: block;
  width: 120px;
  padding: 6px;
  margin: 3px 0;
  text-align: left;
  font-size: 14px;
}

/* ====== Canvasコンテナ ===== */
#canvas-container {
  width: 100%;
  height: calc(100vh - 170px);
  overflow: hidden;
  background: #ccc;
  border: 1px solid #999;
  touch-action: none;
  transform-origin: top left !important;
}

/* ====== Canvas本体 ====== */
#mainCanvas {
  display: block;
  background: #eee;

  transform-origin: top left !important;

  aspect-ratio: auto !important;
  width: auto !important;
  height: auto !important;
}

#brush-size-area {
  text-align: center;
  margin: 10px 0;
}

#brush-size-area.hidden {
  display: none;
}

#brush-size-slider {
  width: 200px;
}
