*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, sans-serif;
  background: #0a0a0a;
  color: #fafafa;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

#toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: #181818;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #2a2a2a;
  max-width: 560px;
}

#tools {
  display: flex;
  gap: 4px;
}

.tool {
  width: 34px;
  height: 34px;
  background: #252525;
  border: 1px solid #333;
  border-radius: 7px;
  color: #bbb;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tool:hover { background: #303030; color: #fff; }
.tool.active { background: #4a6fa5; color: #fff; border-color: #5a8fcc; }

#palette {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 240px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
}

.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: #fff; }

#options {
  display: flex;
  gap: 4px;
}

#options button {
  width: 34px;
  height: 34px;
  background: #252525;
  border: 1px solid #333;
  border-radius: 7px;
  color: #bbb;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

#options button:hover { background: #303030; color: #fff; }
#mirror-btn.active { background: #4a6fa5; color: #fff; border-color: #5a8fcc; }

#color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#custom-color {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  padding: 2px;
  background: #252525;
}

#current-color-display {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2px solid #555;
  display: inline-block;
}

#canvas-wrap {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 0 2px #2a2a2a, 0 8px 40px rgba(0,0,0,0.6);
  cursor: crosshair;
}

canvas {
  display: block;
  image-rendering: pixelated;
}

@media (max-width: 480px) {
  #app { padding: 8px; gap: 8px; }
  #toolbar { padding: 8px 10px; gap: 8px; }
  #palette { max-width: 180px; }
  .swatch { width: 18px; height: 18px; }
}
