:root {
  --bg: #1e1e2e;
  --surface: #2a2a3c;
  --border: #3a3a52;
  --text: #e8e8f0;
  --accent: #4f46e5;
  --danger: #ef4444;
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.app {
  width: 100%;
  max-width: 1000px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

input[type="color"] {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 10px;
  background: none;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 2px solid var(--border);
  border-radius: 10px;
}

.control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: #b9b9cf;
}

input[type="range"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.size-value {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.2rem 0.6rem;
  font-variant-numeric: tabular-nums;
  min-width: 2.4rem;
  text-align: center;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.15);
}

.btn:active {
  transform: scale(0.96);
}

.btn-danger {
  background: var(--danger);
}

.btn.active {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border-radius: 12px;
  cursor: crosshair;
  touch-action: none;
}
