* { box-sizing: border-box; user-select: none; -webkit-user-select: none; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; background: #0f1420; color: #f1f5f9;
  font-family: system-ui, -apple-system, sans-serif; overflow: hidden; touch-action: none;
  display: flex; flex-direction: column;
}
.topbar {
  flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 8px; padding: 8px 12px;
  background: #1a2133; border-bottom: 1px solid #2d3854;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button, .tool-btn {
  background: #26304a; color: #e2e8f0; border: 1px solid #3c4a6e;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.tabs button.active, .tool-btn.active { background: #2563eb; border-color: #60a5fa; color: #fff; }
.hud-goals { font-size: 13px; font-weight: 600; color: #93c5fd; }
.workspace { flex: 1; min-height: 0; min-width: 0; display: flex; overflow: hidden; }
.side-panel {
  width: 290px; max-width: 100%; background: #161c2c; border-right: 1px solid #2d3854;
  padding: 12px; overflow-y: auto; flex-shrink: 0; touch-action: pan-y;
}
.side-panel.hidden { display: none; }
.canvas-wrap {
  flex: 1; min-width: 0; min-height: 0; display: flex;
  align-items: center; justify-content: center; overflow: hidden;
}
canvas { display: block; touch-action: none; }
.tool-group { margin-bottom: 14px; border-bottom: 1px solid #29334d; padding-bottom: 12px; }
.tool-group h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: #94a3b8; }
.tool-sub { margin: 8px 0 4px; font-size: 11px; color: #64748b; }
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.brush-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.brush-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: #202940; border: 1px solid #354263; border-radius: 8px;
  padding: 5px 4px; color: #cbd5e1; font-size: 11px; cursor: pointer;
}
.brush-btn.active { background: #1d4ed8; border-color: #93c5fd; color: #fff; }
.tool-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 12px; flex-wrap: wrap; }
.tool-row input, .tool-row select {
  width: 52px; background: #0b101b; color: #fff; border: 1px solid #3c4a6e; padding: 4px 6px; border-radius: 4px;
}
@media (max-width: 768px) {
  .workspace { flex-direction: column-reverse; }
  .side-panel { width: 100%; height: 48%; border-right: none; border-top: 1px solid #2d3854; }
  .canvas-wrap { width: 100%; height: 52%; }
}
