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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  overflow: hidden;
  max-width: 1400px;
  width: 100%;
}

.toolbar {
  background: #f5f5f5;
  padding: 20px;
  min-width: 250px;
  border-right: 2px solid #e0e0e0;
  overflow-y: auto;
}

.tool-section {
  margin-bottom: 30px;
}

.tool-section h3 {
  font-size: 14px;
  color: #555;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tool-btn {
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn:hover {
  background: #f0f0f0;
  border-color: #667eea;
  transform: translateY(-2px);
}

.tool-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.tool-btn svg {
  stroke-width: 2;
}

.color-picker-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#colorPicker {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.color-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.color-preset {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s;
}

.color-preset:hover {
  transform: scale(1.1);
  border-color: #667eea;
}

#brushSize {
  width: 100%;
  margin-bottom: 8px;
}

#brushSizeValue {
  font-weight: bold;
  color: #667eea;
}

.action-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.action-btn:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.action-btn:active {
  transform: translateY(0);
}

#clearBtn {
  background: #ff4757;
}

#clearBtn:hover {
  background: #ee3647;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
}

.canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: #fafafa;
}

#canvas {
  background: white;
  cursor: crosshair;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  max-width: 100%;
  max-height: 100%;
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }

  .toolbar {
    min-width: 100%;
    border-right: none;
    border-bottom: 2px solid #e0e0e0;
  }

  .tools {
    grid-template-columns: repeat(6, 1fr);
  }
}
