* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: #1a1a1a;
  color: #eee;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.toolbar {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  background: #2d2d2d;
  border-bottom: 1px solid #444;
}

.toolbar h1 {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-group .label {
  font-size: 0.8rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.color-swatches,
.bg-swatches {
  display: flex;
  gap: 4px;
}

.color-swatch,
.bg-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s;
}

.color-swatch:hover,
.bg-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active,
.bg-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 1px #333;
}

.brush-sizes .brush-btn,
.tools .tool-btn,
.shapes .shape-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border: 1px solid #555;
  border-radius: 6px;
  background: #3d3d3d;
  color: #eee;
  cursor: pointer;
}

.brush-sizes .brush-btn:hover,
.tools .tool-btn:hover,
.shapes .shape-btn:hover {
  background: #4d4d4d;
}

.brush-sizes .brush-btn.active,
.tools .tool-btn.active,
.shapes .shape-btn.active {
  background: #0a7ea4;
  border-color: #0a7ea4;
}

.action-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border: 1px solid #555;
  border-radius: 6px;
  background: #3d3d3d;
  color: #eee;
  cursor: pointer;
}

.action-btn:hover {
  background: #4d4d4d;
}

.action-btn.danger {
  background: #8b2635;
  border-color: #8b2635;
}

.action-btn.danger:hover {
  background: #a32f42;
}

.tool-group.actions {
  margin-left: auto;
  gap: 0.5rem;
}

.tool-group.hidden {
  display: none;
}

.canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: #252525;
}

#canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  touch-action: none;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath fill='%23F48FB1' d='M8 0h8v5H8z'/%3E%3Cpath fill='%239E9E9E' d='M7 5h10v2H7z'/%3E%3Cpath fill='%23FFD54F' stroke='%23E6C200' stroke-width='0.5' d='M6 7h12v14H6z'/%3E%3Cpath fill='%23D2B48C' d='M6 21l6 3 6-3v-3H6v3z'/%3E%3Cpath fill='%23333' d='M11.2 22.2l0.8 1.6 0.8-1.6-0.8-0.4z'/%3E%3C/svg%3E") 16 31, crosshair;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #2d2d2d;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #444;
  min-width: 280px;
}

.modal-content p {
  margin: 0 0 1rem 0;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
