:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --fg: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8a8a);
  --surface: var(--tg-theme-secondary-bg-color, #f1f1f1);
  --button: var(--tg-theme-button-color, #2481cc);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

#canvas {
  position: fixed;
  top: 0;
  left: 0;
  background: #fff;
  display: block;
  touch-action: none;
}

#toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.colors {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.colors button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.colors button.active {
  border-color: var(--fg);
  transform: scale(1.1);
}

#size {
  width: 90px;
  accent-color: var(--button);
}

#toolbar button {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 18px;
  color: var(--fg);
  cursor: pointer;
}

#toolbar button:active { background: rgba(0, 0, 0, 0.06); }
